package com.github.bitsapling.sapling.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 帖子表 ：记录每个板块下的帖子
 * </p>
 *
 */
public class Post implements Serializable {

    private static final long serialVersionUID = 1L;


    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 所属版块id
     */
    private Long forumId;

    /**
     * 发帖用户id
     */
    private Long userId;

    /**
     * 帖子标题
     */
    private String title;

    /**
     * 帖子内容
     */
    private String content;

    /**
     * 发帖时间
     */
    private LocalDateTime createdTime;


    /**
     * 是否置顶
     */
    private Integer isPinned;

    private String createdBy;

    public  String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {this.createdBy = createdBy;}

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getForumId() {
        return forumId;
    }

    public void setForumId(Long forumId) {
        this.forumId = forumId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public LocalDateTime getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(LocalDateTime createdTime) {
        this.createdTime = createdTime;
    }

    public Integer getIsPinned() {
        return isPinned;
    }

    public void setIsPinned(Integer isPinned) {
        this.isPinned = isPinned;
    }

    @Override
    public String toString() {
        return "Post{" +
        "id = " + id +
        ", forumId = " + forumId +
        ", userId = " + userId +
        ", title = " + title +
        ", content = " + content +
        ", createdTime = " + createdTime +
        ", isPinned = " + isPinned +
        "}";
    }

    public LocalDateTime getCreateTime() {
        return createdTime;
    }


    public void setCreateTime(LocalDateTime localDateTime) {
        this.createdTime = localDateTime;
    }
}
